package com.xinfan.io;

import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

/**
 * @Author xin
 * @Date 2022/6/7 21:57
 * @Version 1.0
 */
public class IODemo01 {
    public static void main(String[] args) {

    }


    @Test
    public void createFile() {
        //g:\\test.txt  反斜杠需要加一个转义符
        String pathName = "g:/test.txt";
        File file = new File(pathName);
        try {
            file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    @Test
    public void createFile1() {
        File parent = new File("g:\\");
        String path = "xinfan\\note\\a.txt";
        File file = new File(parent, path);
        try {
            file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
